package cate.common.table.activity.destinygate.row;

import cate.common.table.ERow;
import cate.common.table.XSSFRowWrap;
import cp.solution.util.str.Str;
import easy.java.dev.note.NoteField;
import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.List;

public class DestinyGateBaseRow extends ERow {
    @NoteField("配置ID")
    public int configId;
    @NoteField("自选原型2ID")
    public String chooseHeroStr;
    @NoteField("自选原型1ID")
    public String sysHeroId;

    @NoteField("邮件ID")
    public int mailID;

    @Override
    public void parse(XSSFRowWrap xrw) {
        this.id = xrw.getInteger("配置ID");
        this.sysHeroId = xrw.getString("自选原型1ID","");
        this.chooseHeroStr = xrw.getString("自选原型2ID","");
        this.mailID = xrw.getInteger("邮件ID",0);
    }

    @NoteField(value = "2自选原型ID的list")
    public List<Integer> chooseHeroIds = new ArrayList<>();
    @NoteField(value = "1自选原型ID的list")
    public List<Integer> sysHeroIds = new ArrayList<>();

    @Override
    public void decode() {
        super.decode();
        if (StringUtils.isNotBlank(chooseHeroStr)) {
            chooseHeroIds = Str.strArr2intList(chooseHeroStr.split("#"));
        }
        if (StringUtils.isNotBlank(sysHeroId)) {
            sysHeroIds = Str.strArr2intList(sysHeroId.split("#"));
        }
    }
}
